home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / FLEX_2_3 / FLEX.SKE < prev    next >
Text File  |  1992-01-25  |  20KB  |  857 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* scanner skeleton version:
  4.  * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8.  
  9. #include <stdio.h>
  10.  
  11.  
  12. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  13. #ifdef c_plusplus
  14. #ifndef __cplusplus
  15. #define __cplusplus
  16. #endif
  17. #endif
  18.  
  19.  
  20. /* THINK C has ANSI C libraries. */
  21. #ifdef THINK_C
  22. #ifndef __STDC__
  23. #define __STDC__
  24. #endif
  25. #endif
  26.  
  27.  
  28. #ifdef __cplusplus
  29.  
  30. #include <stdlib.h>
  31. #include <osfcn.h>
  32.  
  33. /* use prototypes in function declarations */
  34. #define YY_USE_PROTOS
  35.  
  36. /* the "const" storage-class-modifier is valid */
  37. #define YY_USE_CONST
  38.  
  39. #else    /* ! __cplusplus */
  40.  
  41. #ifdef __STDC__
  42.  
  43. #ifdef __GNUC__
  44. #include <stddef.h>
  45. void *malloc( size_t );
  46. void free( void* );
  47. #else
  48. #include <stdlib.h>
  49. #endif    /* __GNUC__ */
  50.  
  51. #define YY_USE_PROTOS
  52. #define YY_USE_CONST
  53. /* THINK C  version 4 cannot handle const declarations. */
  54. #ifdef THINK_C
  55. #if THINK_C == 1
  56. #undef YY_USE_CONST
  57. #endif
  58. #endif
  59.  
  60. #endif    /* __STDC__ */
  61. #endif    /* ! __cplusplus */
  62.  
  63.  
  64. #ifdef __TURBOC__
  65. #define YY_USE_CONST
  66. #endif
  67.  
  68.  
  69. #ifndef YY_USE_CONST
  70. #define const
  71. #endif
  72.  
  73.  
  74. #ifdef YY_USE_PROTOS
  75. #define YY_PROTO(proto) proto
  76. #else
  77. #define YY_PROTO(proto) ()
  78. /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
  79.  * so it's got to be a K&R compiler, and therefore there's no standard
  80.  * place from which to include these definitions
  81.  */
  82. char *malloc();
  83. int free();
  84. int read();
  85. #endif
  86.  
  87.  
  88. /* amount of stuff to slurp up with each read */
  89. #ifndef YY_READ_BUF_SIZE
  90. #define YY_READ_BUF_SIZE 8192
  91. #endif
  92.  
  93. /* returned upon end-of-file */
  94. #define YY_END_TOK 0
  95.  
  96. /* copy whatever the last rule matched to the standard output */
  97.  
  98. /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  99. /* this used to be an fputs(), but since the string might contain NUL's,
  100.  * we now use fwrite()
  101.  */
  102. #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  103.  
  104. /* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  105.  * is returned in "result".
  106.  */
  107. #ifdef THINK_C
  108. #define YY_INPUT(buf,result,max_size) \
  109.     if ( (result = fread( (char *) buf, 1, max_size, yyin )) < 0 ) \
  110.         YY_FATAL_ERROR( "fread() in flex scanner failed" );
  111. #else
  112. #define YY_INPUT(buf,result,max_size) \
  113.     if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
  114.         YY_FATAL_ERROR( "read() in flex scanner failed" );
  115. #endif
  116. #define YY_NULL 0
  117.  
  118. /* no semi-colon after return; correct usage is to write "yyterminate();" -
  119.  * we don't want an extra ';' after the "return" because that will cause
  120.  * some compilers to complain about unreachable statements.
  121.  */
  122. #define yyterminate() return ( YY_NULL )
  123.  
  124. /* report a fatal error */
  125.  
  126. /* The funky do-while is used to turn this macro definition into
  127.  * a single C statement (which needs a semi-colon terminator).
  128.  * This avoids problems with code like:
  129.  *
  130.  *     if ( something_happens )
  131.  *        YY_FATAL_ERROR( "oops, the something happened" );
  132.  *    else
  133.  *        everything_okay();
  134.  *
  135.  * Prior to using the do-while the compiler would get upset at the
  136.  * "else" because it interpreted the "if" statement as being all
  137.  * done when it reached the ';' after the YY_FATAL_ERROR() call.
  138.  */
  139.  
  140. #define YY_FATAL_ERROR(msg) \
  141.     do \
  142.         { \
  143.         (void) fputs( msg, stderr ); \
  144.         (void) putc( '\n', stderr ); \
  145.         exit( 1 ); \
  146.         } \
  147.     while ( 0 )
  148.  
  149. /* default yywrap function - always treat EOF as an EOF */
  150. #define yywrap() 1
  151.  
  152. /* enter a start condition.  This macro really ought to take a parameter,
  153.  * but we do it the disgusting crufty way forced on us by the ()-less
  154.  * definition of BEGIN
  155.  */
  156. #define BEGIN yy_start = 1 + 2 *
  157.  
  158. /* action number for EOF rule of a given start state */
  159. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  160.  
  161. /* special action meaning "start processing a new file" */
  162. #define YY_NEW_FILE \
  163.     do \
  164.         { \
  165.         yy_init_buffer( yy_current_buffer, yyin ); \
  166.         yy_load_buffer_state(); \
  167.         } \
  168.     while ( 0 )
  169.  
  170. /* default declaration of generated scanner - a define so the user can
  171.  * easily add parameters
  172.  */
  173. #define YY_DECL int yylex YY_PROTO(( void )) 
  174.  
  175. /* code executed at the end of each rule */
  176. #define YY_BREAK break;
  177.  
  178. #define YY_END_OF_BUFFER_CHAR 0
  179.  
  180. #ifndef YY_BUF_SIZE
  181. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  182. #endif
  183.  
  184. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  185.  
  186. %% section 1 definitions go here
  187.  
  188. /* done after the current pattern has been matched and before the
  189.  * corresponding action - sets up yytext
  190.  */
  191. #define YY_DO_BEFORE_ACTION \
  192.     yytext = yy_bp; \
  193. %% code to fiddle yytext and yyleng for yymore() goes here
  194.     yy_hold_char = *yy_cp; \
  195.     *yy_cp = '\0'; \
  196.     yy_c_buf_p = yy_cp;
  197.  
  198. #define EOB_ACT_CONTINUE_SCAN 0
  199. #define EOB_ACT_END_OF_FILE 1
  200. #define EOB_ACT_LAST_MATCH 2
  201.  
  202. /* return all but the first 'n' matched characters back to the input stream */
  203. #define yyless(n) \
  204.     do \
  205.         { \
  206.         /* undo effects of setting up yytext */ \
  207.         *yy_cp = yy_hold_char; \
  208.         yy_c_buf_p = yy_cp = yy_bp + n; \
  209.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  210.         } \
  211.     while ( 0 )
  212.  
  213. #define unput(c) yyunput( c, yytext )
  214.  
  215.  
  216. struct yy_buffer_state
  217.     {
  218.     FILE *yy_input_file;
  219.  
  220.     YY_CHAR *yy_ch_buf;        /* input buffer */
  221.     YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  222.  
  223.     /* size of input buffer in bytes, not including room for EOB characters*/
  224.     int yy_buf_size;    
  225.  
  226.     /* number of characters read into yy_ch_buf, not including EOB characters */
  227.     int yy_n_chars;
  228.  
  229.     int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  230. #define EOF_NOT_SEEN 0
  231.     /* "pending" happens when the EOF has been seen but there's still
  232.      * some text process
  233.      */
  234. #define EOF_PENDING 1
  235. #define EOF_DONE 2
  236.     };
  237.  
  238. static YY_BUFFER_STATE yy_current_buffer;
  239.  
  240. /* we provide macros for accessing buffer states in case in the
  241.  * future we want to put the buffer states in a more general
  242.  * "scanner state"
  243.  */
  244. #define YY_CURRENT_BUFFER yy_current_buffer
  245.  
  246.  
  247. /* yy_hold_char holds the character lost when yytext is formed */
  248. static YY_CHAR yy_hold_char;
  249.  
  250. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  251.  
  252.  
  253.  
  254. #ifndef YY_USER_ACTION
  255. #define YY_USER_ACTION
  256. #endif
  257.  
  258. #ifndef YY_USER_INIT
  259. #define YY_USER_INIT
  260. #endif
  261.  
  262. extern YY_CHAR *yytext;
  263. extern int yyleng;
  264. extern FILE *yyin, *yyout;
  265.  
  266. YY_CHAR *yytext;
  267. int yyleng;
  268.  
  269. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  270.  
  271. %% data tables for the DFA go here
  272.  
  273. /* these variables are all declared out here so that section 3 code can
  274.  * manipulate them
  275.  */
  276. /* points to current character in buffer */
  277. static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  278. static int yy_init = 1;        /* whether we need to initialize */
  279. static int yy_start = 0;    /* start state number */
  280.  
  281. /* flag which is used to allow yywrap()'s to do buffer switches
  282.  * instead of setting up a fresh yyin.  A bit of a hack ...
  283.  */
  284. static int yy_did_buffer_switch_on_eof;
  285.  
  286. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  287. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  288. static int yy_get_next_buffer YY_PROTO(( void ));
  289. static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
  290. void yyrestart YY_PROTO(( FILE *input_file ));
  291. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  292. void yy_load_buffer_state YY_PROTO(( void ));
  293. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  294. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  295. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  296.  
  297. #define yy_new_buffer yy_create_buffer
  298.  
  299. #ifdef __cplusplus
  300. static int yyinput YY_PROTO(( void ));
  301. #else
  302. static int input YY_PROTO(( void ));
  303. #endif
  304.  
  305. YY_DECL
  306.     {
  307.     register yy_state_type yy_current_state;
  308.     register YY_CHAR *yy_cp, *yy_bp;
  309.     register int yy_act;
  310.  
  311. %% user's declarations go here
  312.  
  313.     if ( yy_init )
  314.     {
  315.     YY_USER_INIT;
  316.  
  317.     if ( ! yy_start )
  318.         yy_start = 1;    /* first start state */
  319.  
  320.     if ( ! yyin )
  321.         yyin = stdin;
  322.  
  323.     if ( ! yyout )
  324.         yyout = stdout;
  325.  
  326.     if ( yy_current_buffer )
  327.         yy_init_buffer( yy_current_buffer, yyin );
  328.     else
  329.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  330.  
  331.     yy_load_buffer_state();
  332.  
  333.     yy_init = 0;
  334.     }
  335.  
  336.     while ( 1 )        /* loops until end-of-file is reached */
  337.     {
  338. %% yymore()-related code goes here
  339.     yy_cp = yy_c_buf_p;
  340.  
  341.     /* support of yytext */
  342.     *yy_cp = yy_hold_char;
  343.  
  344.     /* yy_bp points to the position in yy_ch_buf of the start of the
  345.      * current run.
  346.      */
  347.     yy_bp = yy_cp;
  348.  
  349. %% code to set up and find next match goes here
  350.  
  351. yy_find_action:
  352. %% code to find the action number goes here
  353.  
  354.     YY_DO_BEFORE_ACTION;
  355.     YY_USER_ACTION;
  356.  
  357. do_action:    /* this label is used only to access EOF actions */
  358.  
  359. %% debug code goes here
  360.  
  361.     switch ( yy_act )
  362.         {
  363. %% actions go here
  364.  
  365.         case YY_END_OF_BUFFER:
  366.         {
  367.         /* amount of text matched not including the EOB char */
  368.         int yy_amount_of_matched_text = yy_cp - yytext - 1;
  369.  
  370.         /* undo the effects of YY_DO_BEFORE_ACTION */
  371.         *yy_cp = yy_hold_char;
  372.  
  373.         /* note that here we test for yy_c_buf_p "<=" to the position
  374.          * of the first EOB in the buffer, since yy_c_buf_p will
  375.          * already have been incremented past the NUL character
  376.          * (since all states make transitions on EOB to the end-
  377.          * of-buffer state).  Contrast this with the test in yyinput().
  378.          */
  379.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  380.             /* this was really a NUL */
  381.             {
  382.             yy_state_type yy_next_state;
  383.  
  384.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  385.  
  386.             yy_current_state = yy_get_previous_state();
  387.  
  388.             /* okay, we're now positioned to make the
  389.              * NUL transition.  We couldn't have
  390.              * yy_get_previous_state() go ahead and do it
  391.              * for us because it doesn't know how to deal
  392.              * with the possibility of jamming (and we
  393.              * don't want to build jamming into it because
  394.              * then it will run more slowly)
  395.              */
  396.  
  397.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  398.  
  399.             yy_bp = yytext + YY_MORE_ADJ;
  400.  
  401.             if ( yy_next_state )
  402.             {
  403.             /* consume the NUL */
  404.             yy_cp = ++yy_c_buf_p;
  405.             yy_current_state = yy_next_state;
  406.             goto yy_match;
  407.             }
  408.  
  409.             else
  410.             {
  411. %% code to do backtracking for compressed tables and set up yy_cp goes here
  412.             goto yy_find_action;
  413.             }
  414.             }
  415.  
  416.         else switch ( yy_get_next_buffer() )
  417.             {
  418.             case EOB_ACT_END_OF_FILE:
  419.             {
  420.             yy_did_buffer_switch_on_eof = 0;
  421.  
  422.             if ( yywrap() )
  423.                 {
  424.                 /* note: because we've taken care in
  425.                  * yy_get_next_buffer() to have set up yytext,
  426.                  * we can now set up yy_c_buf_p so that if some
  427.                  * total hoser (like flex itself) wants
  428.                  * to call the scanner after we return the
  429.                  * YY_NULL, it'll still work - another YY_NULL
  430.                  * will get returned.
  431.                  */
  432.                 yy_c_buf_p = yytext + YY_MORE_ADJ;
  433.  
  434.                 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  435.                 goto do_action;
  436.                 }
  437.  
  438.             else
  439.                 {
  440.                 if ( ! yy_did_buffer_switch_on_eof )
  441.                 YY_NEW_FILE;
  442.                 }
  443.             }
  444.             break;
  445.  
  446.             case EOB_ACT_CONTINUE_SCAN:
  447.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  448.  
  449.             yy_current_state = yy_get_previous_state();
  450.  
  451.             yy_cp = yy_c_buf_p;
  452.             yy_bp = yytext + YY_MORE_ADJ;
  453.             goto yy_match;
  454.  
  455.             case EOB_ACT_LAST_MATCH:
  456.             yy_c_buf_p =
  457.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  458.  
  459.             yy_current_state = yy_get_previous_state();
  460.  
  461.             yy_cp = yy_c_buf_p;
  462.             yy_bp = yytext + YY_MORE_ADJ;
  463.             goto yy_find_action;
  464.             }
  465.         break;
  466.         }
  467.  
  468.         default:
  469. #ifdef FLEX_DEBUG
  470.         printf( "action # %d\n", yy_act );
  471. #endif
  472.         YY_FATAL_ERROR(
  473.             "fatal flex scanner internal error--no action found" );
  474.         }
  475.     }
  476.     }
  477.  
  478.  
  479. /* yy_get_next_buffer - try to read in a new buffer
  480.  *
  481.  * synopsis
  482.  *     int yy_get_next_buffer();
  483.  *     
  484.  * returns a code representing an action
  485.  *     EOB_ACT_LAST_MATCH - 
  486.  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  487.  *     EOB_ACT_END_OF_FILE - end of file
  488.  */
  489.  
  490. static int yy_get_next_buffer()
  491.  
  492.     {
  493.     register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  494.     register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  495.     register int number_to_move, i;
  496.     int ret_val;
  497.  
  498.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  499.     YY_FATAL_ERROR(
  500.         "fatal flex scanner internal error--end of buffer missed" );
  501.  
  502.     /* try to read more data */
  503.  
  504.     /* first move last chars to start of buffer */
  505.     number_to_move = yy_c_buf_p - yytext;
  506.  
  507.     for ( i = 0; i < number_to_move; ++i )
  508.     *(dest++) = *(source++);
  509.  
  510.     if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  511.     /* don't do the read, it's not guaranteed to return an EOF,
  512.      * just force an EOF
  513.      */
  514.     yy_n_chars = 0;
  515.  
  516.     else
  517.     {
  518.     int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  519.  
  520.     if ( num_to_read > YY_READ_BUF_SIZE )
  521.         num_to_read = YY_READ_BUF_SIZE;
  522.  
  523.     else if ( num_to_read <= 0 )
  524.         YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  525.  
  526.     /* read in more data */
  527.     YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  528.           yy_n_chars, num_to_read );
  529.     }
  530.  
  531.     if ( yy_n_chars == 0 )
  532.     {
  533.     if ( number_to_move == 1 )
  534.         {
  535.         ret_val = EOB_ACT_END_OF_FILE;
  536.         yy_current_buffer->yy_eof_status = EOF_DONE;
  537.         }
  538.  
  539.     else
  540.         {
  541.         ret_val = EOB_ACT_LAST_MATCH;
  542.         yy_current_buffer->yy_eof_status = EOF_PENDING;
  543.         }
  544.     }
  545.  
  546.     else
  547.     ret_val = EOB_ACT_CONTINUE_SCAN;
  548.  
  549.     yy_n_chars += number_to_move;
  550.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  551.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  552.  
  553.     /* yytext begins at the second character in yy_ch_buf; the first
  554.      * character is the one which preceded it before reading in the latest
  555.      * buffer; it needs to be kept around in case it's a newline, so
  556.      * yy_get_previous_state() will have with '^' rules active
  557.      */
  558.  
  559.     yytext = &yy_current_buffer->yy_ch_buf[1];
  560.  
  561.     return ( ret_val );
  562.     }
  563.  
  564.  
  565. /* yy_get_previous_state - get the state just before the EOB char was reached
  566.  *
  567.  * synopsis
  568.  *     yy_state_type yy_get_previous_state();
  569.  */
  570.  
  571. static yy_state_type yy_get_previous_state()
  572.  
  573.     {
  574.     register yy_state_type yy_current_state;
  575.     register YY_CHAR *yy_cp;
  576.  
  577. %% code to get the start state into yy_current_state goes here
  578.  
  579.     for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  580.     {
  581. %% code to find the next state goes here
  582.     }
  583.  
  584.     return ( yy_current_state );
  585.     }
  586.  
  587.  
  588. /* yy_try_NUL_trans - try to make a transition on the NUL character
  589.  *
  590.  * synopsis
  591.  *     next_state = yy_try_NUL_trans( current_state );
  592.  */
  593.  
  594. #ifdef YY_USE_PROTOS
  595. static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  596. #else
  597. static yy_state_type yy_try_NUL_trans( yy_current_state )
  598. register yy_state_type yy_current_state;
  599. #endif
  600.  
  601.     {
  602.     register int yy_is_jam;
  603. %% code to find the next state, and perhaps do backtracking, goes here
  604.  
  605.     return ( yy_is_jam ? 0 : yy_current_state );
  606.     }
  607.  
  608.  
  609. #ifdef YY_USE_PROTOS
  610. static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  611. #else
  612. static void yyunput( c, yy_bp )
  613. YY_CHAR c;
  614. register YY_CHAR *yy_bp;
  615. #endif
  616.  
  617.     {
  618.     register YY_CHAR *yy_cp = yy_c_buf_p;
  619.  
  620.     /* undo effects of setting up yytext */
  621.     *yy_cp = yy_hold_char;
  622.  
  623.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  624.     { /* need to shift things up to make room */
  625.     register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  626.     register YY_CHAR *dest =
  627.         &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  628.     register YY_CHAR *source =
  629.         &yy_current_buffer->yy_ch_buf[number_to_move];
  630.  
  631.     while ( source > yy_current_buffer->yy_ch_buf )
  632.         *--dest = *--source;
  633.  
  634.     yy_cp += dest - source;
  635.     yy_bp += dest - source;
  636.     yy_n_chars = yy_current_buffer->yy_buf_size;
  637.  
  638.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  639.         YY_FATAL_ERROR( "flex scanner push-back overflow" );
  640.     }
  641.  
  642.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  643.     yy_cp[-2] = '\n';
  644.  
  645.     *--yy_cp = c;
  646.  
  647.     /* note: the formal parameter *must* be called "yy_bp" for this
  648.      *       macro to now work correctly
  649.      */
  650.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  651.     }
  652.  
  653.  
  654. #ifdef __cplusplus
  655. static int yyinput()
  656. #else
  657. static int input()
  658. #endif
  659.  
  660.     {
  661.     int c;
  662.     YY_CHAR *yy_cp = yy_c_buf_p;
  663.  
  664.     *yy_cp = yy_hold_char;
  665.  
  666.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  667.     {
  668.     /* yy_c_buf_p now points to the character we want to return.
  669.      * If this occurs *before* the EOB characters, then it's a
  670.      * valid NUL; if not, then we've hit the end of the buffer.
  671.      */
  672.     if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  673.         /* this was really a NUL */
  674.         *yy_c_buf_p = '\0';
  675.  
  676.     else
  677.         { /* need more input */
  678.         yytext = yy_c_buf_p;
  679.         ++yy_c_buf_p;
  680.  
  681.         switch ( yy_get_next_buffer() )
  682.         {
  683.         case EOB_ACT_END_OF_FILE:
  684.             {
  685.             if ( yywrap() )
  686.             {
  687.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  688.             return ( EOF );
  689.             }
  690.  
  691.             YY_NEW_FILE;
  692.  
  693. #ifdef __cplusplus
  694.             return ( yyinput() );
  695. #else
  696.             return ( input() );
  697. #endif
  698.             }
  699.             break;
  700.  
  701.         case EOB_ACT_CONTINUE_SCAN:
  702.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  703.             break;
  704.  
  705.         case EOB_ACT_LAST_MATCH:
  706. #ifdef __cplusplus
  707.             YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  708. #else
  709.             YY_FATAL_ERROR( "unexpected last match in input()" );
  710. #endif
  711.         }
  712.         }
  713.     }
  714.  
  715.     c = *yy_c_buf_p;
  716.     yy_hold_char = *++yy_c_buf_p;
  717.  
  718.     return ( c );
  719.     }
  720.  
  721.  
  722. #ifdef YY_USE_PROTOS
  723. void yyrestart( FILE *input_file )
  724. #else
  725. void yyrestart( input_file )
  726. FILE *input_file;
  727. #endif
  728.  
  729.     {
  730.     yy_init_buffer( yy_current_buffer, input_file );
  731.     yy_load_buffer_state();
  732.     }
  733.  
  734.  
  735. #ifdef YY_USE_PROTOS
  736. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  737. #else
  738. void yy_switch_to_buffer( new_buffer )
  739. YY_BUFFER_STATE new_buffer;
  740. #endif
  741.  
  742.     {
  743.     if ( yy_current_buffer == new_buffer )
  744.     return;
  745.  
  746.     if ( yy_current_buffer )
  747.     {
  748.     /* flush out information for old buffer */
  749.     *yy_c_buf_p = yy_hold_char;
  750.     yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  751.     yy_current_buffer->yy_n_chars = yy_n_chars;
  752.     }
  753.  
  754.     yy_current_buffer = new_buffer;
  755.     yy_load_buffer_state();
  756.  
  757.     /* we don't actually know whether we did this switch during
  758.      * EOF (yywrap()) processing, but the only time this flag
  759.      * is looked at is after yywrap() is called, so it's safe
  760.      * to go ahead and always set it.
  761.      */
  762.     yy_did_buffer_switch_on_eof = 1;
  763.     }
  764.  
  765.  
  766. #ifdef YY_USE_PROTOS
  767. void yy_load_buffer_state( void )
  768. #else
  769. void yy_load_buffer_state()
  770. #endif
  771.  
  772.     {
  773.     yy_n_chars = yy_current_buffer->yy_n_chars;
  774.     yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  775.     yyin = yy_current_buffer->yy_input_file;
  776.     yy_hold_char = *yy_c_buf_p;
  777.     }
  778.  
  779.  
  780. #ifdef YY_USE_PROTOS
  781. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  782. #else
  783. YY_BUFFER_STATE yy_create_buffer( file, size )
  784. FILE *file;
  785. int size;
  786. #endif
  787.  
  788.     {
  789.     YY_BUFFER_STATE b;
  790.  
  791.     b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  792.  
  793.     if ( ! b )
  794.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  795.  
  796.     b->yy_buf_size = size;
  797.  
  798.     /* yy_ch_buf has to be 2 characters longer than the size given because
  799.      * we need to put in 2 end-of-buffer characters.
  800.      */
  801.     b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  802.  
  803.     if ( ! b->yy_ch_buf )
  804.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  805.  
  806.     yy_init_buffer( b, file );
  807.  
  808.     return ( b );
  809.     }
  810.  
  811.  
  812. #ifdef YY_USE_PROTOS
  813. void yy_delete_buffer( YY_BUFFER_STATE b )
  814. #else
  815. void yy_delete_buffer( b )
  816. YY_BUFFER_STATE b;
  817. #endif
  818.  
  819.     {
  820.     if ( b == yy_current_buffer )
  821.     yy_current_buffer = (YY_BUFFER_STATE) 0;
  822.  
  823.     free( (char *) b->yy_ch_buf );
  824.     free( (char *) b );
  825.     }
  826.  
  827.  
  828. #ifdef YY_USE_PROTOS
  829. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  830. #else
  831. void yy_init_buffer( b, file )
  832. YY_BUFFER_STATE b;
  833. FILE *file;
  834. #endif
  835.  
  836.     {
  837.     b->yy_input_file = file;
  838.  
  839.     /* we put in the '\n' and start reading from [1] so that an
  840.      * initial match-at-newline will be true.
  841.      */
  842.  
  843.     b->yy_ch_buf[0] = '\n';
  844.     b->yy_n_chars = 1;
  845.  
  846.     /* we always need two end-of-buffer characters.  The first causes
  847.      * a transition to the end-of-buffer state.  The second causes
  848.      * a jam in that state.
  849.      */
  850.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  851.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  852.  
  853.     b->yy_buf_pos = &b->yy_ch_buf[1];
  854.  
  855.     b->yy_eof_status = EOF_NOT_SEEN;
  856.     }
  857.